package com.nuanshui.heatedloan.credit.handler.impl;

import com.nuanshui.framework.lang.ClassUtil;
import com.nuanshui.framework.utils.LogUtil;
import com.nuanshui.heatedloan.credit.annotation.CustomAuthAnnotation;
import com.nuanshui.heatedloan.credit.constant.CustomAuthHandlerOrderNum;
import com.nuanshui.heatedloan.credit.form.CustomAuthExecuteForm;
import com.nuanshui.heatedloan.credit.handler.CustomAuthHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Set;


/**
 * Created by wangxw on 2017/6/26.
 */
//@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@CustomAuthAnnotation(value="customerBaseInfoAuthHandler", order= CustomAuthHandlerOrderNum.CUSTOM_AUTH)
public class  CustomerBaseInfoAuthHandler implements CustomAuthHandler {

    private Logger logger = LoggerFactory.getLogger("CustomerBaseInfoAuthHandler");
    /***
     * 下一个要执行的认证执行器
     */
    private CustomAuthHandler nextCustomAuthHandler;
    /***
     * 客户基本信息的认证处理逻辑
     * @param customAuthExecuteForm
     */
    @Override
    public void execute(CustomAuthExecuteForm customAuthExecuteForm) {
        LogUtil.info(logger,"---------------------开始进行客户基本信息认证-----------------------");
        try{

        }catch(Exception e){
            e.printStackTrace();
            //更新数据库的状态为认证失败
            LogUtil.info(logger,"---------------------客户基本信息认证出错，错误信息为"+e.getMessage()+"-----------------------");
        }
        LogUtil.info(logger,"---------------------客户基本信息认证结束-----------------------");
    }

    @Override
    public void setNextOrderHandler(CustomAuthHandler customAuthHandler) {
         this.nextCustomAuthHandler=customAuthHandler;
    }

    public static void main(String[] args) {
        Set<Class<?>> authHandlersClass = ClassUtil.getAnnotationClasses(CustomAuthAnnotation.class,"com.nuanshui.heatedloan.credit.handler.impl");
        System.out.println(authHandlersClass.size());
    }
}
